<?php

namespace app\common\model;

use think\model\relation\BelongsTo;
use think\model\relation\HasMany;

class DealerGoods extends BaseModel
{
    //    public function goods(): BelongsTo
    //    {
    //        return $this->belongsTo(Goods::class, 'goods_id', 'id');
    //    }

    //    public function brand(): BelongsTo
    //    {
    //        return $this->belongsTo(DealerGoodsBrand::class,'dealer_brand_id','id');
    //    }

    public function brand(): BelongsTo
    {
        return $this->belongsTo(GoodsBrand::class, 'brand_id', 'id');
    }


    //    public function cate(): BelongsTo
    //    {
    //        return $this->belongsTo(DealerGoodsCate::class,'dealer_cate_id','id');
    //    }

    public function cate(): BelongsTo
    {
        return $this->belongsTo(GoodsCate::class, 'cate_id', 'id');
    }

    public function spec(): HasMany
    {
        return $this->hasMany(DealerGoodsSpec::class, 'dealer_goods_id', 'id');
    }

    public function dealer(): BelongsTo
    {
        return $this->belongsTo(Dealer::class, 'dealer_id', 'id');
    }

    public function zBrand(): BelongsTo
    {
        return $this->belongsTo(GoodsBrand::class, 'brand_id', 'id');
    }

    public function zCate(): BelongsTo
    {
        return $this->belongsTo(GoodsCate::class, 'cate_id', 'id');
    }
}